<script setup>
import { ref } from 'vue';
import { artGetChannelService } from '@/api/article';

const props = defineProps({
    modelValue: {
        type: [Number, String]
    }
})
const emit = defineEmits(['update:modelValue'])
// 调试：检查 props 是否正常接收
console.log("Received modelValue:", props.modelValue);

const getChannelList = ref([])
const getChannel = async () => {
    const res = await artGetChannelService()
    getChannelList.value = res.data.data
    console.log(getChannelList.value);
    // console.log(getChannelList.value[0].id);

}
getChannel()


</script>
<template>
    <el-select placeholder="请选择" :modelValue="modelValue" @update:modelValue="emit('update:modelValue', $event)">
        <el-option v-for="channel in getChannelList" :key="channel.id" :label="channel.cate_name"
            :value="channel.id"></el-option>

    </el-select>
</template>